﻿@model CNRegex.Web.Models.ModelBlogIndex
@using CNRegex.Enum
@{
	ViewBag.Title = "Index";
	Layout = "~/Views/Shared/_Layout.cshtml";
}
<link href="@Url.Content("~/Content/css/BlogIndex.css")" rel="stylesheet" type="text/css" />
<script src="@Url.Content("~/Scripts/jquery.cookie.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/common.js")" type="text/javascript"></script>
<script type="text/javascript">
	function search() {
		var keyWords = jQuery.trim($("#txtKeywords").val());
		window.location.href = "/blog/search/?k="+escape(keyWords);
	}

	function txtFocus() {
		var keyWords = jQuery.trim($("#txtKeywords").val());
		if (keyWords == "搜索文章..") {
			$("#txtKeywords").val("");
		}
	}

</script>

<h2 class="t_h2">精品文章</h2>
<div class="bi_right_content">
	<div class="bi_category_title">
		文章分类
	</div>
	<ul class="bi_category">
	@for (int i = 0; i < Model.RegexUserBlogCataloies.Count; i++)
	 {
		 <li>
			<a href="/blog/index/?c=@Model.RegexUserBlogCataloies[i].ID&t=@((int)EnumListType.类别)">@Model.RegexUserBlogCataloies[i].Name</a>
			<div class="bi_category_desciption">@Model.RegexUserBlogCataloies[i].Description</div>
		 </li>
	 }
	 </ul>
</div>

<div class="bi_left_content">
	<div>
		<ul class="bi_first_nav">
			<li @(Model.ListType == EnumListType.最新 ? "style=background-color:white" : "")><a href="/blog/index/?t=@((int)EnumListType.最新)">最新</a> </li>
			<li @(Model.ListType == EnumListType.推荐 ? "style=background-color:white" : "")><a href="/blog/index/?t=@((int)EnumListType.推荐)">推荐</a> </li>
			<li @(Model.ListType == EnumListType.热门 ? "style=background-color:white" : "")><a href="/blog/index/?t=@((int)EnumListType.热门)">热门</a> </li>
			<li @(Model.ListType == EnumListType.类别 ? "style=padding-top:0px;width:110px;" : "style=padding-top:0px;width:110px;") >
				<ul class="bi_catalog_list_select">
					<li @(Model.ListType != EnumListType.类别 ? "style=text-align:center;padding-left:0px;border:none;" : "style=background-color:White;text-align:center;padding-left:0px;")>
						<a href="/blog/index/?t=@((int)EnumListType.类别)">@(Model.CatalogID == null ? "-- 全部类别 --" : Model.RegexUserBlogCataloies.First(x => x.ID == Model.CatalogID).Name)</a>
					</li>
					@for (int i = 0; i < Model.RegexUserBlogCataloies.Count; i++)
					 {
						 if (Model.RegexUserBlogCataloies[i].ID!=Model.CatalogID)
						 {
						<li>
							<a href="/blog/index/?t=@((int)EnumListType.类别)&c=@(Model.RegexUserBlogCataloies[i].ID)">
								@Model.RegexUserBlogCataloies[i].Name
							</a>
						</li>
						}
					 }
					 @if (Model.CatalogID!=null)
					  {
						<li>
						 <a href="/blog/index/?t=@((int)EnumListType.类别)" style=" font-weight:bold;">
								-- 全部类别 --
						</a>
					</li>
					  }
					 
				</ul>
			</li>
			<li style=" float:right; width:200px; margin-top:-4px;">
				<div id="search">
						<fieldset>
							<input type="text" class="clearClick" value="搜索文章.." id="txtKeywords" onfocus="txtFocus()" />
							<a class="mcmsSearch" href="javascript:search()" id="search_go">Go</a>
						</fieldset>
				</div>
			</li>
		</ul>
		@if (Model.ListType != EnumListType.最新 && Model.ListType != EnumListType.类别)
  {
		<ul class="bi_second_nav">
			<li class="@(Model.DaysBefore == 3 ? "bi_current_days" : "") "><a href="/Blog/Index/?t=@((int)Model.ListType)&days=3">三天</a></li>
			<li class="@(Model.DaysBefore == 7 ? "bi_current_days" : "") "><a href="/Blog/Index/?t=@((int)Model.ListType)&days=7">一周</a></li>
			<li class="@(Model.DaysBefore == 60 ? "bi_current_days" : "") "><a href="/Blog/Index/?t=@((int)Model.ListType)&days=60">一月</a></li>
			<li class="@(Model.DaysBefore == 365 ? "bi_current_days" : "") " style=" border:none;"><a href="/Blog/Index/?t=@((int)Model.ListType)&days=365">一年</a></li>
		</ul>
  }
	</div>
	
	<div class="blogs_list">
		<ul>
			@for (int i = 0; i < Model.ContentBlogs.Count; i++)
   {
				<li>
					<div class="blog_upup" onclick="recommend('/blog/recommend/','@Model.ContentBlogs[i].ID','spanRecommendTimes','@i','recommendBlogCookie','您已经推荐过此文章,谢谢.')">
						<span @Html.Raw(string.Format("id=spanRecommendTimes{0}", i))>@(Model.ContentBlogs[i].Recommend == null ? "0" : Model.ContentBlogs[i].Recommend.Value.ToString())</span>
					</div>
					<div class="blog_item">
						<div class="blog_title">
							<a href="/blog/detail/@Model.ContentBlogs[i].ID">@Model.ContentBlogs[i].Title</a>
						</div>
						<div class="blog_summary">
							@Model.ContentBlogs[i].Summery<text> ...</text>
						</div>
						<div class="blog_tool">
							<a href="/@Model.ContentBlogs[i].RegexUserName" class="blog_author">
								<span>@Model.ContentBlogs[i].RegexUserName</span>
							</a>
							<a href="/blog/detail/@Model.ContentBlogs[i].ID" class="blog_write_time">
								<span>@Model.ContentBlogs[i].CreateDate.Value.ToString("yyyy/MM/dd")</span>
							</a>
							<a href="/blog/detail/@Model.ContentBlogs[i].ID" class="blog_comments">
								<span>评论(@Model.ContentBlogs[i].Comments)</span>
							</a>
							-
							<a href="/blog/detail/@Model.ContentBlogs[i].ID" class="blog_click">
								<span>阅读(@(Model.ContentBlogs[i].ClickCount ?? 0))</span>
							</a>
							-
							<a href="/blog/detail/@Model.ContentBlogs[i].ID" class="blog_catalog">
								<span>分类 - @Model.ContentBlogs[i].RegexUserBlogCatalogName</span>
							</a>
						</div>
					</div>
				</li>
   }
		</ul>
		
	</div>
	@{
			Html.RenderPartial("/Views/Controls/Paginate.cshtml", Model.ExPaginate);
		}
</div>
